
public class testUnit {
	
	private static Menu MyMenu;
	private static MainUI MyUI;
	//private static PurchaseDetailService MyService;

	public static void main(String args[]) throws Exception {
		
		PurchaseBill MyTest = null;
		PurchaseDetailBill[] bills=new PurchaseDetailBill[10];
		Book[] books=new Book[10];
		Provide CY1=new Provide("CY1",1,"NJUST","NJBANK",true);
		MyMenu=new Menu();
		MyUI=new MainUI(MyMenu);
		
		System.out.println("please input the Book's number(it must be less than 10)");
		String numbers=MainUI.br.readLine();
		int cou = numbers.charAt(0)-48;

		for(int i=0;i<10;i++){
			books[i]=new Book();
			if(i<cou){
				BookService.MyBookInit(books[i]);
			}
		}

		for(int i=0;i<10;i++) {
			bills[i]=new PurchaseDetailBill();
		}
		
		bills[8].setBillId(0);
		bills[8].setBooks(books);
		bills[8].setBillName("hhhh1");
		bills[8].setBookNumber(10);
		bills[8].setProvider(CY1);
		bills[8].setBookNumber(cou);
		bills[7].setBillId(1);
		bills[3].setBillId(2);
		bills[0].setBillId(3);
		bills[5].setBillId(4);
		bills[2].setBillId(5);
		bills[9].setBillId(6);
		bills[4].setBillId(7);
		bills[6].setBillId(8);
		bills[1].setBillId(9);
		// for(int i=0;i<10;i++) {
		// 	System.out.println(bills[i].getBillId());
		// }
		try {
			MyTest=new PurchaseBill(bills,10);
			
			//MyTest.PrintMessage();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}
		
		PurchaseDetailService myService=new PurchaseDetailService();
		myService.setBill(MyTest);
		//MyService=new PurchaseDetailService(MyTest);
		MyUI.start();
	}
}
